import { View, Image } from "@tarojs/components"
import Taro from "@tarojs/taro";
import defAvatar from '../../assets/ad-3.png';

export const UserInfoCard = (props: {avatar?:string, nickName?:string}) => {
  const { avatar, nickName } = props;
  const onPreview = () => {
    Taro.previewImage({
      urls: [avatar || defAvatar]
    })
  }

  return (
    <View style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', padding: '10px' }}>
      <Image onClick={onPreview} src={avatar || defAvatar} style={{ width: 50, height: 50, borderRadius: '50%' }} />
      <View style={{ fontSize: 40, marginTop: 20 }}>{nickName || '未登录'}</View>
    </View>
  )
}